
interface IMenu {
    id:number,
    path:string
}
interface IManager {
    id: number;
    name: string;
    role: string;
    dept?: string;
    age: number;
    menus?: IMenu[];
}

//type 类型别名
// type manager = IManager | IUser

let myUsers:IManager[] = [
    { id: 1, name: "xiaowang", role: "商品管理员", dept: "库管", age: 20 },
    { id: 1, name: "xiaowang", role:"超级管理员",menus: [{ id: 1, path: "/home" }], age: 18 },
    { id: 1, name: "xiaowanag",role:"超级管理员", menus: [{ id: 1, path: "/home" }], age: 12 },
]

function fundAll(array:IManager[]){
   return array.filter(item=>item.role=="超级管理员")
}

function getMin(array:IManager[]){
   const minValue =  Math.min.apply(array,array.map(item=>item.age))
   const value = array.filter(item=>item.age == minValue)
   return value
}



